
#include "led.h"




void led_init(void)
{
    /* LED_RED out,PD7. */
	//DDRD |= 0b10000000;
	DDRD |= (1 << DDD7);
    /* LED_GRN out,PB1. */
	//DDRB |= 0b00000010;
	DDRB |= (1 << DDB1);
	
	led_clear(LED_RED);
	led_clear(LED_GRN);
}


void led_set(char led)
{
	if(led == LED_RED)
	{
		//PORTD &= ~0b10000000;
		PORTD &= ~(1<< DDD7);
	}
	else if(led == LED_GRN)
	{
		//PORTB &= ~0b00000010;
		PORTB &=~ (1<< DDB1);
	}
}

void led_clear(char led)
{
	if(led == LED_RED)
	{
		PORTD |= (1<< DDD7);
	}
	else if(led == LED_GRN)
	{
		PORTB |= (1<< DDB1);
	}
}

void led_toggle(char led)
{
	if(led == LED_RED)
	{
		PORTD ^= (1<< DDD7);
	}
	else if(led == LED_GRN)
	{
		PORTB ^= (1<< DDB1);
	}

}
